﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MazeBuilder.Entities.Tiles;
using RoomModuleCatalog;

namespace MazeBuilder
{
  internal class FantasyTileFactory : TileFactory
  {
    /// <exception cref="ArgumentOutOfRangeException"><c></c> is out of range.</exception>
    public override Tile GetTileFromHashCode(int code, int row, int col) {
      Tile result = null;
      var tileCode = (TileCode)code;
      switch (tileCode) {
        case TileCode.None:
          result = new NullTile(row, col);
          break;
        case TileCode.Wall:
          result = new WallTile(row, col);
          break;
        case TileCode.Door:
          result = new DoorTile(row, col);
          break;
        case TileCode.Floor:
          result = new FloorTile(row, col);
          break;
        case TileCode.Void:
          result = new VoidTile(row, col);
          break;
        case TileCode.Spade:
          result = new SpadeTile(row, col);
          break;
        case TileCode.Flame:
          result = new FlameTile(row, col);
          break;
        case TileCode.Skull:
          result = new SkullTile(row, col);
          break;
        case TileCode.Pentagram:
          result = new PentagramTile(row, col);
          break;
        case TileCode.Fountain:
          result = new FountainTile(row, col);
          break;
        default:
          throw new ArgumentOutOfRangeException();
      }
      return result;
    }

    public override Tile GetTile(string tag, int row, int col) {
      Tile tile = null;
      switch (tag) {
        case "wall":
          tile = new WallTile(row, col);
          break;
        case "door":
          tile = new DoorTile(row, col);
          break;
        case "floor":
          tile = new FloorTile(row, col);
          break;
        case "spade":
          tile = new SpadeTile(row, col);
          break;
        case "void":
          tile = new VoidTile(row, col);
          break;
        case "flame":
          tile = new FlameTile(row, col);
          break;
        case "skull":
          tile = new SkullTile(row, col);
          break;
        case "pentagram":
          tile = new PentagramTile(row, col);
          break;
        case "fountain":
          tile = new FountainTile(row, col);
          break;
      }

      return tile;
    }
  }
}
